package cn.laixueit.excption;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@ControllerAdvice
public class HanderException {

    @ExceptionHandler(Exception.class)
    public void ex(Exception e, HttpServletResponse response){
        try {
            response.sendRedirect("/404.html");
        } catch (IOException ioException) {
            ioException.printStackTrace();
        }
    }
}
